package com.ihg.hiex.entity.session.during;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 
 * @author dan
 *
 */
@Entity
@Table(name = "session_in_basket_answer")
public class SessionInBasketAnswer {
    
    @Id
    @GeneratedValue
    private Long id;
    
    /** 第几封邮件 */
    private String name;
    
    /** 类型 */
    @Enumerated(EnumType.STRING)
    private SessionInBasketAnswerType type;
    
    /** communication type */
    private String communicationType;
    
    /** communication to */
    private String communicationTo;
    
    /** content */
    private String content;
    
    /** 状态 */
    @Enumerated(EnumType.STRING)
    private SessionInBasketAnswerStatus status;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private SessionInBasket sessionInBasket;
    
    @Column(name = "is_disabled")
    private boolean disabled;
    
    /**
     * 
     */
    public SessionInBasketAnswer() {
        
    }
    
    /**
     * 
     * @param name
     * @param type
     * @param sessionInBasket
     */
    public SessionInBasketAnswer(String name, SessionInBasketAnswerType type, SessionInBasket sessionInBasket) {
        this.name = name;
        this.type = type;
        this.status = SessionInBasketAnswerStatus.EDITING;
        this.sessionInBasket = sessionInBasket;
        this.disabled = false;
    }
    
    /**
     * 
     * @param sessionInBasket
     * @return
     */
    public SessionInBasketAnswer initilization(SessionInBasket sessionInBasket) {
        this.sessionInBasket = sessionInBasket;
        this.status = SessionInBasketAnswerStatus.EDITING;
        this.disabled = false;
        return this;
    }
    
    /**
     * 
     * @return
     */
    public SessionInBasketAnswer delete() {
        this.disabled = true;
        return this;
    }
    
    /**
     * @return
     */
    public SessionInBasketAnswer finish() {
        this.status = SessionInBasketAnswerStatus.FINISH;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the type
     */
    public SessionInBasketAnswerType getType() {
        return type;
    }

    /**
     * @return the communicationType
     */
    public String getCommunicationType() {
        return communicationType;
    }

    /**
     * @return the communicationTo
     */
    public String getCommunicationTo() {
        return communicationTo;
    }

    /**
     * @return the content
     */
    public String getContent() {
        return content;
    }

    /**
     * @return the status
     */
    public SessionInBasketAnswerStatus getStatus() {
        return status;
    }

    /**
     * @return the sessionInBasket
     */
    public SessionInBasket getSessionInBasket() {
        return sessionInBasket;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @param type the type to set
     */
    public void setType(SessionInBasketAnswerType type) {
        this.type = type;
    }

    /**
     * @param communicationType the communicationType to set
     */
    public void setCommunicationType(String communicationType) {
        this.communicationType = communicationType;
    }

    /**
     * @param communicationTo the communicationTo to set
     */
    public void setCommunicationTo(String communicationTo) {
        this.communicationTo = communicationTo;
    }

    /**
     * @param content the content to set
     */
    public void setContent(String content) {
        this.content = content;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(SessionInBasketAnswerStatus status) {
        this.status = status;
    }

    /**
     * @param sessionInBasket the sessionInBasket to set
     */
    public void setSessionInBasket(SessionInBasket sessionInBasket) {
        this.sessionInBasket = sessionInBasket;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

}
